import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
import pluginVue from 'eslint-plugin-vue'

// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
// import { configureVueProject } from '@vue/eslint-config-typescript'
// configureVueProject({ scriptLangs: ['ts', 'tsx'] })
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup

export default defineConfigWithVueTs(
  {
    name: 'app/files-to-lint',
    files: ['**/*.{ts,mts,tsx,vue}']
  },

  {
    name: 'app/files-to-ignore',
    ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**']
  },

  pluginVue.configs['flat/essential'],
  vueTsConfigs.recommended,
  skipFormatting,

  // 允许使用 any 类型
  {
    rules: {
      '@typescript-eslint/no-explicit-any': 'off',
      // 修改 vue/multi-word-component-names 规则
      'vue/multi-word-component-names': 'off'
    }
  }
)

// 1.安装插件 pnpm i -D eslint-plugin-prettier
// 2.配置 module.exports = { 'extends': [ 'plugin:prettier/recommended' ] }  // 会读取.prettier.json的配置，让eslint在检测时候跟prettier保持一致
